home *** CD-ROM | disk | FTP | other *** search
- Path: newsserver.amsinc.com!usenet
- From: Chris Corry <christopher_corry@mail.amsinc.com>
- Newsgroups: comp.lang.c++
- Subject: A Number class
- Date: Thu, 15 Feb 1996 12:07:06 -0500
- Organization: American Management Systems, Inc.
- Message-ID: <3123683A.7928@mail.amsinc.com>
- NNTP-Posting-Host: ccorry.amsinc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- I posted this question awhile ago and no one bit, so I'll try it again
- (_I_ think it's an interesting question <g>):
-
- I recall reading a few years ago -- in an issue of C++ Report, I believe --
- a columnist arguing rather persuasively that writing a Number class, and
- getting it right, is actually quite difficult. By "right" I mean with full
- operator, precedence, and behavior semantics (i.e., everywhere I can use
- say, an int, I should be able to use a Number). I'm interested in exactly
- what makes this so hard. I can think of a few things but the most
- damaging (and yes, it is pretty minor) is that array initializer semantics
- could not be maintained.
-
- // Legal
- int IntArray[] = { 12, 23, 34, 45, 56 };
-
- // Illegal
- Number NumArray[] = { 12, 23, 34, 45, 56 };
-
-
-
- =====================================================================
- Chris Corry, Principal
- American Management Systems, Inc.
- christopher_corry@mail.amsinc.com
- =====================================================================
-